package com.road.vast.springboot;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.TaskService;

/**
 * @Author 郭泽鹏
 * @Date 2020/6/27 20:43
 * @Version 1.0
 * @Description 任务候选人拾取任务
 *      拾取任务的过程就是：将候选用户转化为真正任务的负责人（让assignee有值）
 */
public class CandidateClaim {
    public static void main(String[] args) {
        //创建ProcessEngine对象
        ProcessEngine defaultProcessEngine = ProcessEngines.getDefaultProcessEngine();

        //创建TaskService对象
        TaskService taskService = defaultProcessEngine.getTaskService();

        //任务id
        String taskId = "112502";
        //候选人名字
        String candidate_user = "bb0";

        //拾取任务
        if (taskId != null){
            taskService.claim(taskId, candidate_user);
            System.out.println("任务ID：" + taskId + "拾取完毕！");
        }
    }
}
